//
//  MQComposeMenuButton.swift
//  SinaWeiBo
//
//  Created by 毛强 on 16/1/27.
//  Copyright © 2016年 itheima. All rights reserved.
//

import UIKit

class MQComposeMenuButton: UIButton {
    
    override var highlighted:Bool{
        get{
            return false
        }
        set{
            
        }
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        setupUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    private func setupUI(){
        self.titleLabel?.font = UIFont.systemFontOfSize(16)
        self.titleLabel?.textAlignment = .Center
        self.imageView?.contentMode = .Center
        self.setTitleColor(UIColor.darkGrayColor(), forState: UIControlState.Normal)
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        //图片放在上面
        imageView?.frame.origin.x = 0
        imageView?.frame.origin.y = 0
        imageView?.frame.size = CGSizeMake(frame.width, frame.width)
        
        //文字放在下面
        titleLabel?.frame.origin.x = 0
        titleLabel?.frame.origin.y = frame.width
        titleLabel?.frame.size = CGSizeMake(frame.width, frame.height - frame.width)
    }
    
    
}
